// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables, must_be_immutable
import 'package:flutter/material.dart';

import 'package:junyeyishu/utils/utils.dart';
import 'package:junyeyishu/widgets/QGWebViewWidget.dart';
import 'package:junyeyishu/widgets/QGNavigationBar.dart';

class QGRulePage extends StatefulWidget {
  Map<String, dynamic> args;
  QGRulePage({super.key, required this.args});
  @override
  State<QGRulePage> createState() => _QGRulePageState();
}

class _QGRulePageState extends State<QGRulePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Color(0xFFFFFFFF),
        body: Column(
          children: [
            buildTop(),
            buildContent(),
          ],
        ));
  }

  buildTop() {
    return Column(
      children: [
        QGNavigationBar(title: widget.args["title"] ?? ""),
        Container(height: 0.5.rpx, color: Color(0xFFEAEAEA)),
      ],
    );
  }

  buildContent() {
    return Expanded(
      child: SingleChildScrollView(
        child: Container(
          margin: EdgeInsets.symmetric(horizontal: 20.rpx, vertical: 30.rpx),
          child: widget.args["web"] == "1"
              ? QGWebViewWidget(
                  str: widget.args["content"] ?? "", bgColor: "#ffffff")
              : Text(
                  widget.args["content"] ?? "",
                  style: TextStyle(
                      height: 1.8,
                      color: Color(0xFF111111),
                      fontSize: 13.rpx,
                      fontWeight: FontWeight.normal),
                ),
        ),
      ),
    );
  }
}
